package com.holyant.goods.enums;

/**
 * @Auther: tswsoft
 * @Date: 2021/03/24/3:27 PM
 * @Description: 发货方式
 */
public enum DeliveryTypeEnum {

    WAREHOUST(10, "保税区发货"),
    HONGK(20, "香港直邮"),
    ABROAD(30, "海外直邮"),
    HOME(50, "国内发货"),
    MEIYA(60, "美亚商城");

    private final Integer code;
    private final String name;

    DeliveryTypeEnum(Integer code, String name)
    {
        this.code = code;
        this.name = name;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getName()
    {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (DeliveryTypeEnum item : DeliveryTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (DeliveryTypeEnum item : DeliveryTypeEnum.values()) {
            if (item.getName().equals(name)) {
                return item.code;
            }
        }
        return null;
    }
}
